<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <title>{:get_system_config('site_name')}</title>

  {include file='common/_require'/}

</head>

<body>
  {include file='common/_header'/}
  {include file='common/_index_header'/}
  <script>$('.index-post-nav-index').addClass('layui-this')</script>
  <div class="layui-container">
    <div class="layui-row layui-col-space15">
      <div class="layui-col-md8">
        {notempty name='list_top_post'}
        <div class="fly-panel">
          <div class="fly-panel-title fly-filter">
            <a>置顶</a>
            <a href="#signin" class="layui-hide-sm layui-show-xs-block fly-right" id="LAY_goSignin" style="color: #FF5722;">去签到</a>
          </div>
          <ul class="fly-list">
            {volist name='list_top_post' id='post'}

            <li>
              <a href="{$post.user.index_url}" class="fly-avatar">
                <img src="{$post.user.avatar_src}" alt="{$post.user.nickname}">
              </a>
              <h2>
                <a class="layui-badge">{$post.category.title}</a>
                <a href="{$post.read_url}">{$post.title}</a>
              </h2>
              <div class="fly-list-info">
                <a href="{$post.user.index_url}" link>
                  <cite>{$post.user.nickname}</cite>
                  {eq name='$post.user.auth_status' value='1'}
                  <i class="iconfont icon-renzheng" title="{$post.user.auth_content}"></i>
                  {/eq}
                  <i class="layui-badge fly-badge-vip">{$user.vip.title|default="VIP0"}</i>
                </a>
                <span>{$post.publish_time_tran}</span>

                <!-- <span class="fly-list-kiss layui-hide-xs" title="悬赏飞吻"><i class="iconfont icon-kiss"></i> 60</span> -->
                <!-- <span class="layui-badge fly-badge-accept layui-hide-xs">已结</span> -->
                <span class="fly-list-nums">
                  <i class="iconfont icon-pinglun1" title="回答"></i> {$post.comment}
                </span>
              </div>
              <div class="fly-list-badge">

                <span class="layui-badge layui-bg-black">置顶</span>
                {eq name='$post.is_good' value='1'}
                <span class="layui-badge layui-bg-red">精帖</span>
                {/eq}

              </div>
            </li>

            {/volist}
          </ul>
        </div>
        {/notempty}

        <div class="fly-panel" style="margin-bottom: 0;">

          <div class="fly-panel-title fly-filter">
            <a href="{:url('Post/index', array_merge($Request.get,[]) )}" class="layui-this">综合</a>
            <span class="fly-mid"></span>
            <a href="{:url('Post/index', array_merge($Request.get,['is_good'=>1]) )}">精华</a>
            <span class="fly-filter-right layui-hide-xs">
              <a href="{:url('Post/index', array_merge($Request.get,['sort_by'=>'create_time']) )}" class="layui-this">按最新</a>
              <span class="fly-mid"></span>
              <a href="{:url('Post/index', array_merge($Request.get,['sort_by'=>'comment']) )}">按热议</a>
            </span>
          </div>

          <ul class="fly-list">
            {volist name='list_index_post' id='post'}

            <li>
              <a href="{$post.user.index_url}" class="fly-avatar">
                <img src="{$post.user.avatar_src}" alt="{$post.user.nickname}">
              </a>
              <h2>
                <a class="layui-badge">{$post.category.title}</a>
                <a href="{:url('Post/read',['id'=>$post.id])}">{$post.title}</a>
              </h2>
              <div class="fly-list-info">
                <a href="{$post.user.index_url}" link>
                  <cite>{$post.user.nickname}</cite>
                  {eq name='$post.user.auth_status' value='1'}
                  <i class="iconfont icon-renzheng" title="{$post.user.auth_content}"></i>
                  {/eq}
                  <i class="layui-badge fly-badge-vip">{$user.vip.title|default="VIP0"}</i>
                </a>
                <span>{$post.publish_time_tran}</span>

                <!-- <span class="fly-list-kiss layui-hide-xs" title="悬赏飞吻"><i class="iconfont icon-kiss"></i> 60</span> -->
                <!--<span class="layui-badge fly-badge-accept layui-hide-xs">已结</span>-->
                <span class="fly-list-nums">
                  <i class="iconfont icon-pinglun1" title="回答"></i> {$post.comment}
                </span>
              </div>
              <div class="fly-list-badge">
                {eq name='$post.is_good' value='1'}
                <span class="layui-badge layui-bg-red">精帖</span>
                {/eq}
              </div>
            </li>
            {/volist}

          </ul>
          <div style="text-align: center">
            <div class="laypage-main">
              <a href="{:url('Post/index')}" class="laypage-next">更多求解</a>
            </div>
          </div>

        </div>
      </div>
      <div class="layui-col-md4">

        <div class="fly-panel">
          <h3 class="fly-panel-title">
            温馨通道
          </h3>
          <ul class="fly-panel-main fly-list-static">
            {volist name='list_index_notice' id='nav'}

            <li>
              <a href="{$nav.value}" target="{$nav.target}">{$nav.title}</a>
            </li>
            {/volist}

          </ul>
        </div>


        <div class="fly-panel fly-signin" id="signin">
          <div class="fly-panel-title">
            签到
            <!-- <i class="fly-mid"></i>
            <a href="javascript:;" class="fly-link" id="LAY_signinHelp">说明</a>
            <i class="fly-mid"></i>
            <a href="javascript:;" class="fly-link" id="LAY_signinTop">活跃榜<span class="layui-badge-dot"></span></a> -->
            <span class="fly-signin-days">已连续签到<cite>{$checkin_last_times|default='0'}</cite>天</span>
          </div>
          <div class="fly-panel-main fly-signin-main">

            {if $is_checkin }

            <button class="layui-btn layui-btn-disabled">今日已签到</button>
            <!-- <span>获得了<cite>20</cite>飞吻</span> -->

            {else /}
            <button class="layui-btn layui-btn-danger" id="do_checkin">今日签到</button>
            <!-- <span>可获得<cite>5</cite>飞吻</span> -->
            {/if}

            <!-- 已签到状态 -->
          </div>
        </div>

        <div class="fly-panel fly-rank fly-rank-reply" id="LAY_replyRank">
          <h3 class="fly-panel-title">回贴周榜</h3>
          <dl>
            {volist name='list_comments_users' id='vo'}

            <dd>
              <a href="{$vo.user.index_url}">
                <img src="{$vo.user.avatar_src}"><cite>{$vo.user.nickname}</cite><i>{$vo.count}次回答</i>
              </a>
            </dd>
            {/volist}
          </dl>
        </div>

        <dl class="fly-panel fly-list-one">
          <dt class="fly-panel-title">本周热议</dt>
          {volist name='list_comments_posts' id='vo'}
          <dd>
            <a href="{$vo.post.read_url}">{$vo.post.title}</a>
            <span><i class="iconfont icon-pinglun1"></i> {$vo.count}</span>
          </dd>

          {/volist}
          {empty name='list_comments_posts'}

          <div class="fly-none">没有相关数据</div>

          {/empty}

          <!-- 无数据时 -->
          <!--
        -->
        </dl>
        {notempty name='\app\model\Nav::getListIndexNav("index_ad")'}
        <div class="fly-panel">
          <div class="fly-panel-title">
            赞助广告
          </div>
          <div class="fly-panel-main">
            {volist name='\app\model\Nav::getListIndexNav("index_ad")' id='nav'}
            {empty name='$nav->getData("img")'}
            <a href="{$nav.value}" target="{$nav.target}" class="fly-zanzhu" style="background-color: #66CCFF ;">{$nav.title}</a>
            {else /}
            <a href="{$nav.value}" target="{$nav.target}" class="fly-zanzhu" style="background-image: url('{$nav.img}');background-size: cover;background-position: center;">{$nav.title}</a>
            {/empty}
            {/volist}
          </div>
        </div>
        {/notempty}

        <div class="fly-panel fly-link">
          <h3 class="fly-panel-title">友情链接</h3>
          <dl class="fly-panel-main">
            {volist name='\app\model\Nav::getListIndexNav("friend_link")' id='nav'}
            <dd>
              <a href="{$nav.value}" target="{$nav.target}">{$nav.title}</a>
            </dd>
            {/volist}

          </dl>
        </div>

      </div>
    </div>
  </div>

  {include file='common/_footer'/}
  <script>


    $('#do_checkin').click(function () {
      $.post('{:url("User/doCheckin")}', function (result) {
        if (result.code == 0) {
          layer.msg('签到成功');

          setTimeout(() => {
            location.reload()
          }, 1200);
        } else {
          layer.msg(result.msg)
        }
      })
    })

  </script>
</body>

</html>